#include <stdio.h>
//This function prints time to user from integer input.
//If the time is invalid, en error message is printed.
//@param time The time as integer

void time_calc(int time){
	int hours;
	int minutes;
	hours = time /100;
	minutes = time % 100; 
	if(minutes > 59 || hours > 24 || time < 0){
		printf("Abnormal input!\n");
		return;
	}
	printf("The time is: ");
	if( hours > 12){
		printf("%d:%dpm\n", hours-12, minutes);
	}
	else{
		printf("%d:%dam\n", hours, minutes);
	}
}

//main function
void main(){
	
	int clock;
	printf("Please enter the time: \n");
	scanf("%d", &clock);
	time_calc(clock);

}